package chixing.day19.homework.work1_1;

import java.util.List;

public class Order {
    private User user;
    private List<Product> productList;
    private double originalSumPrice;

    public Order(){}
    public Order(User user, List<Product> productList){
        this.user = user;
        this.productList = productList;
        for (Product p : productList) {
            this.originalSumPrice +=p.getProductPrice();
        }
    }
    public Order(User user, List<Product> productList, double originalSumPrice) {
        this.user = user;
        this.productList = productList;
        this.originalSumPrice = originalSumPrice;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public List<Product> getProductList() {
        return productList;
    }

    public void setProductList(List<Product> productList) {
        this.productList = productList;
    }

    public double getOriginPrice() {
        return originalSumPrice;
    }

    public void setOriginPrice(double originPrice) {
        this.originalSumPrice = originPrice;
    }

    @Override
    public String toString() {
        return "Order{" +
                "user=" + user +
                ", productList=" + productList +
                ", originPrice=" + originalSumPrice +
                '}';
    }
}
